<?php

/**
 * MVM_MALL 网上商店系统  管理员行动管理
 * ============================================================================
 * 版权所有 (C) 2007-2010 www.mvmmall.com，并保留所有权利。
 * 网站地址: http://www.mvmmall.com
 * ----------------------------------------------------------------------------
 * 这是一个免费开源的软件；这意味着您可以在不用于商业目的的前提下对程序代码
 * 进行修改、使用和再发布。
 * ============================================================================
 * $Author:  www.mvmmall.com  $
 * $Date: 2008-02-27 $
 * $Id: manager.inc.php www.mvmmall.com$
 * ---------------------------------------------
*/

if(!defined('MVMMALL') || !defined('IN_ADMINCP')) exit('Access Denied');

if($action=='list'){
    if($ps_st and $ps_ss) {
        $ps_ss = trim($ps_ss);
        if($ps_st == "id") {
            $serch_sql = "where manager_id like '%$ps_ss%'";
        } elseif($ps_st == "name") {
            $serch_sql = "where manager_name like '%$ps_ss%'";
        }
        $total_count = $db->counter("{$tablepre}manager_table", "$serch_sql", "*");
    } else {
        $total_count = $db->counter("{$tablepre}manager_table", "$serch_sql", "*");
    }

    $list_num = 30;
    $page_num = 10;

    $total_page = @ceil($total_count / $list_num);

    if ($ps_page == "") $ps_page = 1;
    $from_record = ($ps_page - 1) * $list_num;
    $counter = $total_count - (($ps_page - 1) * $list_num);

    $query = "select * from {$tablepre}manager_table $serch_sql order by uid desc limit $from_record, $list_num";
    $result = $db->query($query);
    require_once template('manager');
} 
/**删除数据**/
elseif ($action=='delete') {
    $temp_date = $m_now_time - (60*60*24*30);
    $db->query("DELETE FROM {$tablepre}manager_table WHERE register_date < '$temp_date'");
     admin_msg($lang[success]);
} 
else {
    admin_msg($lang[pass_worng]);
}
?>
